﻿import QtQuick 2.4

Item
{
    id:root_index
    height:width/76*286
    width: 76
    transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl-0.3;yScale: root.y_enl-0.3}
//transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl;yScale: root.y_enl}
    //判断选中
    property bool selectaqi:true
    property bool selectpm2p5:false
    property bool selectpm10:false
    property bool selectso2:false
    property bool selectno2:false
    property bool selectco:false
    property bool selecto3:false

    Image
    {
        id:bg
        width:parent.width
        height:parent.height

        source:"./切图/检测指标/底子.png"
        anchors.right: parent.right
        anchors.verticalCenter: parent.verticalCenter

    }
    property int font1size:14
    property int font2size:10

    Image
    {
        id:aqi
        width:parent.width
        height:width/76*41
//        transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl;yScale: root.y_enl}
        source:
        {
            if(selectaqi)
            {
                return "./切图/检测指标/aqi选中底子.png"
            }
            else
            {
                return ""
            }
        }
        anchors.right: bg.right
        anchors.top:bg.top
        Text
        {
            id:textaqi
            text:"AQI"
            font.pixelSize:  font1size
            font.family: "微软雅黑"
            anchors.centerIn: parent
            color:selectaqi?"#1fefbb":"white"
        }
        MouseArea//1
        {
            anchors.fill:aqi
            onClicked:
            {
                setZero()
                selectaqi=true
                //TODO
                mainApp.slotActiveIndexChanged(6)
            }
        }

    }
    Image
    {
        id:pm2p5
        width:parent.width
        height:width/76*41
//        transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl;yScale: root.y_enl}
        source:
        {
            if(selectpm2p5)
            {
                return "./切图/检测指标/aqi选中底子.png"
            }
            else
            {
                return ""
            }
        }
        anchors.right: bg.right
        anchors.top:aqi.bottom
        Text
        {
            id:textpm2p5
            text:"PM2.5"
             font.pixelSize:  font1size
             font.family: "微软雅黑"
            color:selectpm2p5?"#1fefbb":"white"
            anchors.centerIn: parent
        }
        MouseArea//2
        {
            anchors.fill:pm2p5
            onClicked:
            {
                setZero()
                selectpm2p5=true
                mainApp.slotActiveIndexChanged(1)
                //TODO
            }
        }

    }
    Image
    {
        id:pm10
        width:parent.width
        height:width/76*41
//        transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl;yScale: root.y_enl}
        source:
        {
            if(selectpm10)
            {
                return "./切图/检测指标/aqi选中底子.png"
            }
            else
            {
                return ""
            }
        }
        anchors.right: bg.right
        anchors.top:pm2p5.bottom
        Text
        {
            id:textpm10
            text:"PM10"
             font.pixelSize:  font1size
             font.family: "微软雅黑"
            color:selectpm10?"#1fefbb":"white"
            anchors.centerIn: parent
        }
        MouseArea//3
        {
            anchors.fill:pm10
            onClicked:
            {
                setZero()
                selectpm10=true
                mainApp.slotActiveIndexChanged(0)
                //TODO
            }
        }

    }
    Image
    {
        id:so2
        width:parent.width
        height:width/76*41
//        transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl;yScale: root.y_enl}
        source:
        {
            if(selectso2)
            {
                return "./切图/检测指标/aqi选中底子.png"
            }
            else
            {
                return ""
            }
        }
        anchors.right: bg.right
        anchors.top:pm10.bottom
        Text
        {
            id:textSo2
            text:"SO"
            font.family: "微软雅黑"
            font.pixelSize:  font1size
            color:selectso2?"#1fefbb":"white"
            anchors.centerIn: parent
        }
        Text
        {
            text:"2"
            color:textSo2.color
            font.pixelSize: font2size
            font.family: "微软雅黑"
            anchors.baseline: textSo2.baseline
            anchors.baselineOffset:4
            anchors.left: textSo2.right
        }
        MouseArea//4
        {
            anchors.fill:so2
            onClicked:
            {
                setZero()
                selectso2=true
                mainApp.slotActiveIndexChanged(2)
                //TODO
            }
        }

    }
    Image
    {
        id:no2
        width:parent.width
        height:width/76*41
//        transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl;yScale: root.y_enl}
        source:
        {
            if(selectno2)
            {
                return "./切图/检测指标/aqi选中底子.png"
            }
            else
            {
                return ""
            }
        }
        anchors.right: bg.right
        anchors.top:so2.bottom
        Text
        {
            id:textNo2
            text:"NO"
            font.family: "微软雅黑"
            font.pixelSize:  font1size
            color:selectno2?"#1fefbb":"white"
            anchors.centerIn: parent
        }
        Text
        {
            text:"2"
            color:textNo2.color
            font.pixelSize: font2size
            font.family: "微软雅黑"
            anchors.baseline: textNo2.baseline
            anchors.baselineOffset:4
            anchors.left: textNo2.right
        }
        MouseArea//5
        {
            anchors.fill:no2
            onClicked:
            {
                setZero()
                selectno2=true
                //TODO
                mainApp.slotActiveIndexChanged(3)
            }
        }

    }
    Image
    {
        id:co
        width:parent.width
        height:width/76*41
//        transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl;yScale: root.y_enl}
        source:
        {
            if(selectco)
            {
                return "./切图/检测指标/aqi选中底子.png"
            }
            else
            {
                return ""
            }
        }
        anchors.right: bg.right
        anchors.top:no2.bottom
        Text
        {
            id:textCo
            text:"CO"
            font.family: "微软雅黑"
            font.pixelSize:  font1size
            color:selectco?"#1fefbb":"white"
            anchors.centerIn: parent
        }
        MouseArea//6
        {
            anchors.fill:co
            onClicked:
            {
                setZero()
                selectco=true
                //TODO
                mainApp.slotActiveIndexChanged(4)
            }
        }

    }
    Image
    {
        id:o3
        width:parent.width
        height:width/76*41
//        transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl;yScale: root.y_enl}
        source:
        {
            if(selecto3)
            {
                return "./切图/检测指标/aqi选中底子.png"
            }
            else
            {
                return ""
            }
        }
        anchors.right: bg.right
        anchors.top:co.bottom
        Text
        {
            id:textO3
            text:"O"
            font.pixelSize:  font1size
            font.family: "微软雅黑"
            color:selecto3?"#1fefbb":"white"
            anchors.centerIn: parent
            Text
            {
                text:"3"
                color:textO3.color
                font.pixelSize:  font2size
                font.family: "微软雅黑"
                anchors.baseline: textO3.baseline
                anchors.baselineOffset:4
                anchors.left: textO3.right
            }

        }
        MouseArea//7
        {
            anchors.fill:o3
            onClicked:
            {
                setZero()
                selecto3=true
                //TODO
                mainApp.slotActiveIndexChanged(5)
            }
        }

    }

    function setZero()
    {
        selectaqi=false
        selectpm2p5=false
        selectpm10=false
        selectso2=false
        selectno2=false
        selectco=false
        selecto3=false
    }

}
